var calOperation = "C";
var inputOperation = "I";
var operation = "+";
var cleared = true;
var left = "0";
var right = "";
var lastOperation = calOperation;
var temResult = null;
var textField=document.getElementById("textField");

function caculate(input) {
	var tagName = input.tagName;
	var value = input.value;
	alert(left++);
}

function doInput(input) {
	var value = input.value;
	if (lastOperation == inputOperation) {
		right = right + value;
	} else if (lastOperation == calOperation) {
		right = value;
	}
}

function doOperate(operation) {
	var value = operation.value;
	if (lastOperation == inputOperation) {
		var left = eval(left + operation + right);
		textField.value=left;
		operation=value;		
	}else if(lastOperation==calOperation){
		operation=value;
	}
}
